package com.scm.java.net.basic.action;

import com.scm.entity.base.Supplier;
import com.scm.java.net.basic.service.SupplierService;
import com.scm.java.net.system.action.BasicAction;

public class SupplierAction extends BasicAction {
	private Supplier supplier;
	private SupplierService supplierService;
	/**
     * 查询供应商，返回列表页
     * 
     * @return
     * @throws Exception
     */
    public String list() throws Exception {
        paginatedQuery("supplier.getSupplier");
        return "list";
    }
    /**
     * 转到新增页
     * 
     * @return
     * @throws Exception
     */
    public String toAdd() throws Exception {
        return "add";
    }
    /**
     * 新增供应商
     * 
     * @return
     * @throws Exception
     */
    public String addSupplier() throws Exception {
        // ID是否重复
        supplierService.addSupplier(supplier);
        return "succ";
    }
    /**
     * 转到编辑页
     * 
     * @return
     * @throws Exception
     */
    public String toEdit() throws Exception {
        supplier = (Supplier) supplierService.getSupplier(supplier).get(0);
        return "edit";
    }
    /**
     * 修改供应商
     * 
     * @return
     * @throws Exception
     */
    public String editSupplier() throws Exception {
        supplierService.editSupplier(supplier);
        return "succ";
    }
    /**
     * 删除供应商
     * 
     * @return
     * @throws Exception
     */
    public String delSupplier() throws Exception {
        supplierService.delSupplier(supplier);
        return "succ";
    }
	public Supplier getSupplier() {
		return supplier;
	}

	public void setSupplier(Supplier supplier) {
		this.supplier = supplier;
	}

	public SupplierService getSupplierService() {
		return supplierService;
	}

	public void setSupplierService(SupplierService supplierService) {
		this.supplierService = supplierService;
	}

}
